package create.factory.factory_demo1;

import java.util.stream.Stream;

/**
 * @author yeyangtao
 * @date 2020/5/20 15:26
 */
public class FactoryDemo {
    public static void main(String[] args) {
        ShapeFactory shapeFactory = new ShapeFactory();
        Shape shape1 = shapeFactory.getShape("circle");
        Shape shape2 = shapeFactory.getShape("rectangle");
        shape1.draw();
        shape2.draw();


        Stream.of("circle", "square", "rectangle")
                .map(shapeFactory::getShape)
                .peek(Shape::draw)
                .count();//中断流
    }
}
